<!-- 底部 -->
<footer class="text-center text-color-999">
	Copyright © <?php echo date('Y'); ?> - <?php echo get_setting('site_name'); ?>
	<p><a href="<?php echo base_url(); ?>/<?php if (get_setting('url_rewrite_enable') != 'Y') { ?><?php echo G_INDEX_SCRIPT; ?><?php } ?>ignore_ua_check-TRUE"><?php _e('访问桌面版网站'); ?></a></p>
</footer>
<!-- end 底部 -->

<!-- DO NOT REMOVE -->
<div id="aw-ajax-box" class="aw-ajax-box"></div>

<!-- nav -->
<div class="nav">
	<ul>
		<?php if ($this->user_id) { ?>
		<li>
			<a href="m/home/" <?php if ($_GET['act'] == 'home') { ?>class="active"<?php } ?>><i class="icon icon-list"></i><?php _e('动态'); ?> <i class="icon-tips new-action" <?php if ($this->user_info['notification_unread'] <= 0 ) { ?>style="display:none;"<?php } ?>></i> </a>
		</li>
		<?php } ?>

		<li>
			<a href="m/" <?php if ($_GET['act'] == 'index') { ?>class="active"<?php } ?>><i class="icon icon-home"></i><?php _e('发现'); ?></a>
		</li>

		<?php if (!$this->user_id) { ?>
		<li>
			<a href="m/topic/" <?php if ($_GET['act'] == 'topic') { ?>class="active"<?php } ?>><i class="icon icon-topic"></i><?php _e('话题'); ?></a>
		</li>
		<?php } ?>

		<li>
			<a href="m/publish/"<?php if ($_GET['act'] == 'publish') { ?>class="active"<?php } ?>><i class="icon icon-ask"></i><?php _e('发起'); ?></a>
		</li>

		<?php if (!$this->user_id) { ?>
		<li>
			<a href="m/search/"<?php if ($_GET['act'] == 'search') { ?>class="active"<?php } ?>><i class="icon icon-search"></i><?php _e('搜索'); ?></a>
		</li>
		<?php }?>
		<li>
			<a class="user"><span class="triangle"></span><i class="icon icon-user"></i><?php _e('我'); ?><?php if (!$this->user_id OR $this->user_info['inbox_unread'] != 0) { ?><i class="icon-tips"></i><?php } ?></a>
		</li>

		<?php if ($this->user_id) { ?>
		<li>
			<a class="more"><span class="triangle"></span><i class="icon icon-more"></i><?php _e('更多'); ?></a>
		</li>
		<?php } ?>
	</ul>
	<div class="aw-popover user active">
		<ul>
			<?php if ($this->user_id) { ?>
			<li>
				<a href="people/<?php echo $this->user_info['url_token']; ?>">
					<span class="label">
						<img class="img" alt="<?php echo $this->user_info['user_name']; ?>" src="<?php echo get_avatar_url($this->user_info['uid'], 'mid'); ?>" />
					</span>
					<?php echo $this->user_info['user_name']; ?>
				</a>
			</li>
			<li>
				<a href="m/inbox/">
					<span class="label">
						<i class="icon icon-inbox"></i>
					</span>
					<?php _e('私信'); ?>
					<?php if ($this->user_info['inbox_unread'] != 0) {?>
						<span class="badge badge-danger"><?php echo $this->user_info['inbox_unread']?></span>
					<?php } ?>
				</a>
			</li>
			<li>
				<a href="m/settings/">
					<span class="label">
						<i class="icon icon-setting"></i>
					</span>
					<?php _e('设置'); ?>
				</a>
			</li>
			<li>
				<a href="account/logout/">
					<span class="label">
						<i class="icon icon-logout"></i>
					</span>
					<?php _e('退出'); ?>
				</a>
			</li>
			<?php } else { ?>
			<li>
				<a href="m/login/">
					<span class="label">
						<i class="icon icon-login"></i>
					</span>
					<?php _e('登录'); ?>
				</a>
			</li>
			<?php if (get_setting('sina_weibo_enabled') == 'Y') { ?>
			<li>
				<a href="account/openid/weibo/bind/<?php echo $return_url; ?>">
					<span class="label">
						<i class="icon icon-weibo"></i>
					</span>
					<?php _e('微博登录'); ?>
				</a>
			</li>
			<?php } ?>
			<?php if (get_setting('qq_login_enabled') == 'Y') { ?>
			<li>
				<a href="account/openid/qq/bind/<?php echo $return_url; ?>">
					<span class="label">
						<i class="icon icon-qq"></i>
					</span>
					<?php _e('QQ登录'); ?>
				</a>
			</li>
			<?php } ?>
			<?php if (get_setting('register_type') == 'open') { ?>
			<li>
				<a href="m/register/">
					<span class="label">
						<i class="icon icon-signup"></i>
					</span>
					<?php _e('注册'); ?>
				</a>
			</li>
			<?php } ?>
			<?php } ?>
		</ul>
	</div>
	<div class="aw-popover more">
		<ul>
			<li>
				<a href="m/search/">
					<span class="label">
						<i class="icon icon-search"></i>
					</span>
					<?php _e('搜索'); ?>
				</a>
			</li>
			<li>
				<a href="m/people/">
					<span class="label">
						<i class="icon icon-user"></i>
					</span>
					<?php _e('用户'); ?>
				</a>
			</li>
			<li>
				<a href="m/topic/">
					<span class="label">
						<i class="icon icon-topic"></i>
					</span>
					<?php _e('话题'); ?>
				</a>
			</li>
		</ul>
	</div>
</div>
<!-- end nav -->

<div style="display:none">
	<?php echo get_setting('statistic_code'); ?>
</div>
<!-- / DO NOT REMOVE -->

<?php if (in_weixin()) { ?>
<script src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
<script type="text/javascript">
$(document).ready(function() {
	$('.header').hide();
});

wx.config({
	debug: false,
	appId: '<?php echo get_setting("weixin_app_id"); ?>',
	timestamp: '<?php echo TIMESTAMP; ?>',
	nonceStr: '<?php echo $this->weixin_noncestr; ?>',
	signature: '<?php echo $this->weixin_signature; ?>',
	jsApiList: [
		'checkJsApi',
		'onMenuShareTimeline',
		'onMenuShareAppMessage',
		'onMenuShareQQ',
		'onMenuShareWeibo'
		]
});

var WEIXIN_IMG_COVER;

if ($('.aw-question-detail .markitup-box img').length)
{
	WEIXIN_IMG_COVER = $('.aw-question-detail .markitup-box img').first().attr('src');
}
else
{
	WEIXIN_IMG_COVER = '<?php echo G_STATIC_URL; ?>/common/weixin_default_cover.png';
}

wx.ready(function () {
	wx.checkJsApi({
		jsApiList: ["onMenuShareTimeline", "onMenuShareAppMessage", "onMenuShareQQ", "onMenuShareWeibo"],
		success: function() {
			// 朋友圈
			wx.onMenuShareTimeline({
				title: document.title,
				desc: ($('#weixin-desc').text() == '') ? $('meta[name="description"]').attr('content') : $('#weixin-desc').text(),
				link: location.href,
				imgUrl: WEIXIN_IMG_COVER
			});
		
			// 朋友
			wx.onMenuShareAppMessage({
				title: document.title,
				desc: ($('#weixin-desc').text() == '') ? $('meta[name="description"]').attr('content') : $('#weixin-desc').text(),
				link: location.href,
				imgUrl: WEIXIN_IMG_COVER
			});
		
			// QQ
			wx.onMenuShareQQ({
				title: document.title,
				desc: ($('#weixin-desc').text() == '') ? $('meta[name="description"]').attr('content') : $('#weixin-desc').text(),
				link: location.href,
				imgUrl: WEIXIN_IMG_COVER
			});
		
			// 腾讯微博
			wx.onMenuShareWeibo({
				title: document.title,
				desc: ($('#weixin-desc').text() == '') ? $('meta[name="description"]').attr('content') : $('#weixin-desc').text(),
				link: location.href,
				imgUrl: WEIXIN_IMG_COVER
			});
		}
	})
});
</script>
<?php } ?>
</body>
</html>
